package org.example.adminbackend.client;

import org.example.adminbackend.common.Result;
import org.example.pojo.AdCategory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 广告分类服务Feign客户端
 */
@FeignClient(name = "ad-service", path = "/api/categories", contextId = "adCategoryServiceClient")
public interface AdCategoryServiceClient {

    /**
     * 获取所有分类
     */
    @GetMapping
    Result<List<AdCategory>> getAllCategories();

    /**
     * 根据ID获取分类
     */
    @GetMapping("/{id}")
    Result<AdCategory> getCategoryById(@PathVariable("id") Integer id);

    /**
     * 创建分类
     */
    @PostMapping
    Result<AdCategory> createCategory(@RequestBody AdCategory category);

    /**
     * 更新分类
     */
    @PutMapping("/{id}")
    Result<AdCategory> updateCategory(@PathVariable("id") Integer id, @RequestBody AdCategory category);

    /**
     * 删除分类
     */
    @DeleteMapping("/{id}")
    Result<String> deleteCategory(@PathVariable("id") Integer id);
}